package com.abhimanyu.service;

import java.util.ArrayList;
import java.util.List;

import net.webservicex.Currency;
import net.webservicex.CurrencyConvertor;

import com.abhimanyu.service.model.DollarRateServiceData;

public class DollarRateObserver implements ICurrencyRateObserver {

	public List<DollarRateServiceData> getCurrentDollarRate() {

		double value = new CurrencyConvertor().getCurrencyConvertorSoap()
				.conversionRate(Currency.USD, Currency.INR);
		DollarRateServiceData serviceModel = new DollarRateServiceData();
		List<DollarRateServiceData> serviceModelList = new ArrayList<DollarRateServiceData>();
		serviceModel.setDollarRateData(Double.valueOf(value).toString());
		serviceModel.setServiceName(toString());
		serviceModelList.add(serviceModel);
		return serviceModelList;
	}

	@Override
	public String toString() {
		return "Dollar exchange rate";
	}
}
